<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MCSManager 用户信息</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', sans-serif;
            background: #f5f6fa;
            padding: 20px;
            color: #2c3e50;
        }

        .container {
            max-width: 800px;
            margin: 0 auto;
            background: white;
            border-radius: 10px;
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
            padding: 20px;
        }

        .header {
            text-align: center;
            padding-bottom: 20px;
            border-bottom: 1px solid #eee;
            margin-bottom: 20px;
        }

        .header h1 {
            color: #34495e;
            font-size: 24px;
            margin-bottom: 10px;
        }

        .page-info {
            color: #7f8c8d;
            font-size: 14px;
        }

        .user-list {
            display: grid;
            gap: 20px;
        }

        .user-card {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 15px;
        }

        .user-header {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 1px solid #eee;
        }

        .user-avatar {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background: #3498db;
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            margin-right: 15px;
        }

        .user-title {
            flex: 1;
        }

        .user-name {
            font-size: 18px;
            color: #2c3e50;
            margin-bottom: 4px;
        }

        .user-role {
            font-size: 12px;
            padding: 2px 8px;
            border-radius: 12px;
            display: inline-block;
        }

        .role-admin {
            background: #e74c3c;
            color: white;
        }

        .role-user {
            background: #3498db;
            color: white;
        }

        .role-banned {
            background: #95a5a6;
            color: white;
        }

        .info-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
        }

        .info-item {
            padding: 8px;
        }

        .info-label {
            color: #7f8c8d;
            font-size: 14px;
            margin-bottom: 4px;
        }

        .info-value {
            color: #2c3e50;
            font-size: 15px;
        }

        .instance-list {
            margin-top: 15px;
            padding-top: 15px;
            border-top: 1px solid #eee;
        }

        .instance-title {
            font-size: 16px;
            color: #2980b9;
            margin-bottom: 10px;
        }

        .instance-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 10px;
        }

        .instance-item {
            background: white;
            padding: 10px;
            border-radius: 6px;
            border: 1px solid #eee;
        }

        .instance-name {
            font-weight: bold;
            margin-bottom: 5px;
        }

        .instance-type {
            font-size: 12px;
            color: #7f8c8d;
        }

        .badge {
            display: inline-block;
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 12px;
            margin-left: 5px;
        }

        .badge-enabled {
            background: #27ae60;
            color: white;
        }

        .badge-disabled {
            background: #95a5a6;
            color: white;
        }

        .footer {
            text-align: center;
            color: #95a5a6;
            font-size: 12px;
            margin-top: 20px;
            padding-top: 20px;
            border-top: 1px solid #eee;
        }

        .pagination {
            display: flex;
            justify-content: center;
            margin-top: 20px;
            gap: 10px;
        }

        .page-info {
            padding: 5px 10px;
            background: #f8f9fa;
            border-radius: 4px;
            font-size: 14px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>MCSManager 用户列表</h1>
            <div class="page-info">
                第 <%=page%>/<%=totalPage%> 页，共 <%=total%> 个用户
            </div>
        </div>

        <div class="user-list">
            <% for(let user of users){ %>
            <div class="user-card">
                <div class="user-header">
                    <div class="user-avatar">
                        <%=user.username.charAt(0).toUpperCase()%>
                    </div>
                    <div class="user-title">
                        <div class="user-name">
                            <%=user.username%>
                            <span class="user-role <%=user.role==='管理员'?'role-admin':user.role==='已封禁'?'role-banned':'role-user'%>">
                                <%=user.role%>
                            </span>
                        </div>
                        <div class="user-id">ID: <%=user.id%></div>
                    </div>
                </div>

                <div class="info-grid">
                    <div class="info-item">
                        <div class="info-label">创建时间</div>
                        <div class="info-value"><%=user.createTime%></div>
                    </div>
                    <div class="info-item">
                        <div class="info-label">最后登录</div>
                        <div class="info-value"><%=user.lastLoginTime%></div>
                    </div>
                    <div class="info-item">
                        <div class="info-label">双因素认证</div>
                        <div class="info-value">
                            <%=user.is2FAEnabled ? '已开启' : '未开启'%>
                            <span class="badge <%=user.is2FAEnabled?'badge-enabled':'badge-disabled'%>">
                                <%=user.is2FAEnabled?'已开启':'未开启'%>
                            </span>
                        </div>
                    </div>
                    <div class="info-item">
                        <div class="info-label">API密钥</div>
                        <div class="info-value">
                            <%=user.apiKey ? '已设置' : '未设置'%>
                            <span class="badge <%=user.apiKey?'badge-enabled':'badge-disabled'%>">
                                <%=user.apiKey?'已设置':'未设置'%>
                            </span>
                        </div>
                    </div>
                </div>

                <% if(user.instances && user.instances.length > 0){ %>
                <div class="instance-list">
                    <div class="instance-title">
                        <i>📦</i> 实例列表 (<%=user.instances.length%>)
                    </div>
                    <div class="instance-grid">
                        <% for(let inst of user.instances){ %>
                        <div class="instance-item">
                            <div class="instance-name"><%=inst.name || '未拥有'%></div>
                            <div class="instance-type"><%=inst.type || '未知'%></div>
                        </div>
                        <% } %>
                    </div>
                </div>
                <% } %>
            </div>
            <% } %>
        </div>

        <div class="pagination">
            <div class="page-info">
                共 <%=total%> 个用户，每页 <%=pageSize%> 条
            </div>
        </div>

        <div class="footer">
            Generated by Yunzai-Bot MCSManager Plugin
        </div>
    </div>
</body>
</html>
